/******************************************************************************
* File description: passwordui.h
* Function: 密码UI
* Current Version: 1.0.0
* Author: 张宇轩
* Date: 2024-08-19
*  -----
*  Copyright by 博坤生物 .
 *****************************************************************************/
#ifndef PASSWORDUI_H
#define PASSWORDUI_H

#include <QObject>
#include <QQuickWidget>
#include <QQmlContext>

class PasswordUI : public QQuickWidget
{
    Q_OBJECT

public:
    PasswordUI();
    ~PasswordUI();

signals:
    void passwordIsCorrect(); // 密码正确

    // 发给qml
    void clearPassword(); // 清空密码框

private slots:
    // qml信号的槽函数
    void onSubmit(QString pwd); // 确认
    void onCancel(); // 取消

public:
    QQmlContext* getContext() const; // 获取qmlcontext
    QObject* getRootObject() const; // 获取rootObject

protected:
    void closeEvent(QCloseEvent *event) override; // 关闭窗口事件

private:
    QObject *_rootObj;
    QQmlContext *_rootContext;

    QString _initPwd = "123456"; // 初始密码
};

#endif // PASSWORDUI_H
